//
//  MYGMedicalToolsCalorieApi.swift
//  MYGrow
//
//  Created by 林矗 on 2024/4/9.
//

import UIKit
import Moya
enum MYGMedicalToolsCalorieApi {
    case records(date: Date)
    case sportRecords(date: Date)
}

extension MYGMedicalToolsCalorieApi: MYGTargetType {
    var params: [String : Any] {
        var params: [String: Any] = [:]
        switch self {
        case .records(let date):
            params["date"] =  date.string(withFormat: "yyyy-MM-dd")
        case .sportRecords(let date):
            params["date"] =  date.string(withFormat: "yyyy-MM-dd")
        }
        return params
    }
    
    var path: String {
        switch self {
        case .records:
            "/api/calorie/diet"
        case .sportRecords:
            "/api/calorie/motion"
        }
    }
    
    
    var method: Moya.Method {
        switch self {
        case .records, .sportRecords:
            .get
        }
    }
    
    var isServer: Int {
        1
    }
}
